package com.lzy.chat.c_service;


import com.lzy.chat.a_entity.User;
import com.lzy.chat.b_mapper.UserMapper;
import com.lzy.chat.c_service.Exception.Exceptions;
import com.lzy.chat.c_service.Exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service("VerifyLogin")
public class VerifyLoginServiceImpl implements LoginService {

    private UserMapper userMapper;

    @Autowired
    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    public User login(Integer id, String password){
        User user = userMapper.getUserById(id);
        if (user == null) throw new ServiceException(Exceptions.UserNotFoundException, "未找到此用户->id:" + id);
        return user;
    }

}